package com.door.erp.model;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 * 订单
 * 
 * @author yangxuelin
 */
@Entity
@Table(name = "orderItem", catalog = "door")
public class OrderItem implements Serializable {

	private static final long serialVersionUID = 8280314314355454289L;

	private long id;

	private Product product;

	private Orders order;

	/**
	 * 门扇
	 */
	private DoorLeaf doorLeaf;
	/**
	 * 线型 ：实木，卡口，平口
	 */
	private LineShape lineShape;
	private String color;
	private String remark;
	/**
	 * 门套
	 */
	private DoorFrame doorframe;

	@Id
	@GeneratedValue
	@Column(name = "id", unique = true, nullable = false)
	public long getId() {
		return id;
	}

	@OneToOne(cascade=CascadeType.ALL)
	@JoinColumn(name = "lineShapeId", nullable = true)
	public LineShape getLineShape() {
		return lineShape;
	}

	public void setLineShape(LineShape lineShape) {
		this.lineShape = lineShape;
	}

	@OneToOne(cascade=CascadeType.ALL)
	@JoinColumn(name = "doorFrameId", nullable = true)
	public DoorFrame getDoorframe() {
		return doorframe;
	}

	public void setDoorframe(DoorFrame doorframe) {
		this.doorframe = doorframe;
	}

	public void setId(long id) {
		this.id = id;
	}

	@OneToOne()
	@JoinColumn(name = "productId", nullable = false)
	public Product getProduct() {
		return product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	@ManyToOne
	@JoinColumn(name = "orderId", updatable = false)
	public Orders getOrder() {
		return order;
	}

	public void setOrder(Orders order) {
		this.order = order;
	}

	public String getColor() {
		return color;
	}

	public void setColor(String color) {
		this.color = color;
	}

	@Column(name = "remark")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@OneToOne(cascade=CascadeType.ALL)
	@JoinColumn(name = "doorLeafId", nullable = true)
	public DoorLeaf getDoorLeaf() {
		return doorLeaf;
	}

	public void setDoorLeaf(DoorLeaf doorLeaf) {
		this.doorLeaf = doorLeaf;
	}

}
